package com.wss.day06.string;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @author wangshaoshuai
 * @desc TODO
 * @date 2025/4/26
 */
public class Test01 {
    public static void main(String[] args) {
        String[] arr = {"nba", "abc", "cba", "zz", "qq", "haha"};


        String[] arr1 = arr.clone();
        Arrays.sort(arr1);
        System.out.println("方式一排序结果: " + Arrays.toString(arr1));


        String[] arr2 = arr.clone();
        Arrays.sort(arr2, new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                return s1.compareTo(s2);
            }
        });
        System.out.println("方式二排序结果: " + Arrays.toString(arr2));
    }
}
